home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / sound / wave.h < prev    next >
C/C++ Source or Header  |  2000-02-21  |  4KB  |  100 lines

  1. #ifndef WAVE_H_INCLUDED
  2. #define WAVE_H_INCLUDED
  3.  
  4. #define MAX_WAVE 4
  5.  
  6. /*****************************************************************************
  7.  *    CassetteWave interface
  8.  *****************************************************************************/
  9.  
  10. struct Wave_interface {
  11.     int num;
  12.     int mixing_level[MAX_WAVE];
  13. };
  14.  
  15. extern int wave_sh_start(const struct MachineSound *msound);
  16. extern void wave_sh_stop(void);
  17. extern void wave_sh_update(void);
  18.  
  19. /*****************************************************************************
  20.  * functions for the IODevice entry IO_CASSETTE. Example for the macro
  21.  * IO_CASSETTE_WAVE(1,"wav\0cas\0",mycas_id,mycas_init,mycas_exit)
  22.  *****************************************************************************/
  23.  
  24. extern int wave_init(int id, const char *name);
  25. extern void wave_exit(int id);
  26. extern const void *wave_info(int id, int whatinfo);
  27. extern int wave_open(int id, int mode, void *args);
  28. extern void wave_close(int id);
  29. extern int wave_status(int id, int newstatus);
  30. extern int wave_seek(int id, int offset, int whence);
  31. extern int wave_tell(int id);
  32. extern int wave_input(int id);
  33. extern void wave_output(int id, int data);
  34. extern int wave_input_chunk(int id, void *dst, int chunks);
  35. extern int wave_output_chunk(int id, void *src, int chunks);
  36.  
  37. #define IO_CASSETTE_WAVE(count,fileext,id,init,exit)    \
  38. {                                                        \
  39.     IO_CASSETTE,        /* type */                        \
  40.     count,                /* count */                     \
  41.     fileext,            /* file extensions */            \
  42.     NULL,                /* private */                    \
  43.     id,                 /* id */                        \
  44.     init,                /* init */                        \
  45.     exit,                /* exit */                        \
  46.     wave_info,            /* info */                        \
  47.     wave_open,            /* open */                        \
  48.     wave_close,         /* close */                     \
  49.     wave_status,        /* status */                    \
  50.     wave_seek,            /* seek */                        \
  51.     wave_tell,            /* tell */                        \
  52.     wave_input,         /* input */                     \
  53.     wave_output,        /* output */                    \
  54.     wave_input_chunk,    /* input_chunk */                \
  55.     wave_output_chunk    /* output_chunk */                \
  56. }
  57.  
  58. /*****************************************************************************
  59.  * Use this structure for the "void *args" argument of device_open()
  60.  * file
  61.  *      file handle returned by osd_fopen() (mandatory)
  62.  * display
  63.  *      display cassette icon, playing time and total time on screen
  64.  * fill_wave
  65.  *      callback to fill in samples (optional)
  66.  * smpfreq
  67.  *      sample frequency when the wave is generated (optional)
  68.  *      used for fill_wave() and for writing (creating) wave files
  69.  * header_samples
  70.  *      number of samples for a cassette header (optional)
  71.  * trailer_samples
  72.  *      number of samples for a cassette trailer (optional)
  73.  * chunk_size
  74.  *      number of bytes to convert at once (optional)
  75.  * chunk_samples
  76.  *      number of samples produced for a data chunk (optional)
  77.  *****************************************************************************/
  78. struct wave_args {
  79.     void *file;
  80.     int display;
  81.     int (*fill_wave)(INT16 *buffer, int length, UINT8 *bytes);
  82.     int smpfreq;
  83.     int header_samples;
  84.     int trailer_samples;
  85.     int chunk_size;
  86.     int chunk_samples;
  87. };
  88.  
  89. /*****************************************************************************
  90.  * Your (optional) fill_wave callback will be called with "UINT8 *bytes" set
  91.  * to one of these values if you should fill in the (optional) header or
  92.  * trailer samples into the buffer.
  93.  * Otherwise 'bytes' is a pointer to the chunk of data
  94.  *****************************************************************************/
  95. #define CODE_HEADER     ((UINT8*)-1)
  96. #define CODE_TRAILER    ((UINT8*)-2)
  97.  
  98. #endif
  99.  
  100.